﻿@model StoreScopeConfigurationModel

@inject Nop.Core.IWebHelper webHelper

@{
    var returnUrl = webHelper.GetRawUrl(Context.Request);
    var stores = await Model.Stores.SelectAwait(async store => new SelectListItem
    {
        Text = store.Name,
        Value = Url.Action("ChangeStoreScopeConfiguration", "Setting", new { storeid = store.Id, returnUrl }, webHelper.GetCurrentRequestProtocol()),
        Selected = store.Id.Equals(Model.StoreId)
    }).ToListAsync();
    stores.Insert(0, new SelectListItem
    {
        Text = T("Admin.Configuration.Settings.StoreScope.AllStores").Text,
        Value = Url.Action("ChangeStoreScopeConfiguration", "Setting", new { storeid = 0, returnUrl }, webHelper.GetCurrentRequestProtocol()),
        Selected = 0.Equals(Model.StoreId)
    });
}

<div class="form-group row">
    <div class="col-md-auto">
        <div class="label-wrapper">
            <label class="col-form-label">
                @T("Admin.Configuration.Settings.StoreScope")
            </label>
        </div>
    </div>
    <div class="col-md-3 store-scope-configuration">
        <nop-select asp-for-name="store-scope-configuration" asp-items="@stores" onchange="setLocation(this.value);" style="width: auto;min-width: 300px;" />
        @if (Model.StoreId > 0)
        {
            <div class="checkbox">
                <label>
                    <input type="checkbox" onclick="checkAllOverriddenStoreValue(this)">
                    <b>@T("Admin.Configuration.Settings.StoreScope.CheckAll")</b> @T("Admin.Configuration.Settings.StoreScope.CheckAll.Hint")
                </label>
            </div>
        }
    </div>
</div>